import java.util.ArrayList;
import java.util.List;

/**
 * @projectName: com.xiayuanxing.designPattern
 * @className: College
 * @author: xiayuanxing
 * @description: TODO
 * @date: 2021/12/28 14:18
 * @version: 1.0
 */
public class College extends OrganizationComponent{

    List<OrganizationComponent> organizationComponents=new ArrayList<OrganizationComponent>();

    //构造器
    public College(String name, String des) {
        super(name, des);
    }

    @Override
    protected void add(OrganizationComponent organizationComponent){
        organizationComponents.add(organizationComponent);
    }

    @Override
    protected void remove(OrganizationComponent organizationComponent){
        organizationComponents.remove(organizationComponent);
    }

    @Override
    public String getName() {
        return super.getName();
    }

    @Override
    public String getDes() {
        return super.getDes();
    }

    //print方法，就是输出University包含的学院
    @Override
    protected void print() {
        System.out.println("--------------"+getName()+"--------------");
        for (OrganizationComponent organizationComponent : organizationComponents) {
            organizationComponent.print();
        }
    }
}
